<?php
/**
 * Installer paths configuration page
 *
 * @copyright		The XOOPS project http://www.xoops.org/
 * @license			http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
 * @package			installer
 * @since			2.0.18
 * @version			$Id: page_pathsettings.php 606 2006-07-02 13:49:40Z skalpa $
 *
 * @author			Haruki Setoyama  <haruki@planewave.org>
 * @author			Kazumi Ono <webmaster@myweb.ne.jp>
 * @author			Skalpa Keo <skalpa@xoops.org>
 * @author			dugris <dugris@frxoops.org>
**/

require_once 'common.inc.php';
include_once './class/pathcontroller.php';

if ( !defined('XOOPS_INSTALL') ) { die('XOOPS Custom Installation die'); }
$wizard->setPage( 'pathsettings' );
$pageHasForm = true;
$pageHasHelp = true;

$ctrl = new PathStuffController();
$ctrl->execute();

if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
	return;
}

ob_start();

$msg_Path = $ctrl->validRootPath ? sprintf( XOOPS_FOUND, XOOPS_VERSION ) : ERR_NO_XOOPS_FOUND;
echo "<fieldset><legend>" . PHYSICAL_PATH . "</legend>\n";
echo xoFormField( 'root_path',	$ctrl->xoopsRootPath, XOOPS_ROOT_PATH_LABEL, XOOPS_ROOT_PATH_HELP );
echo "\n<div id='rootpathimg'>" . xoDiag( $ctrl->validRootPath , $msg_Path ) . "</div>";
echo "\n</fieldset>\n";

if ( $ctrl->validTrustPath  ) {
	echo "<fieldset><legend>" . TRUST_PATH . "</legend>\n";
	echo xoFormField( 'trust_path',	$ctrl->TrustPath, TRUST_PATH_LABEL, TRUST_PATH_HELP );
	echo "\n</fieldset>\n";
}

echo "<fieldset><legend>" . WEB_LOCATION . "</legend>\n";
echo xoFormField( 'url',	$ctrl->xoopsUrl, XOOPS_URL_LABEL, XOOPS_URL_HELP );
echo "\n</fieldset>\n";

if ( $ctrl->validRootPath && !empty( $ctrl->permErrors ) ) {
	echo "\n<div id='rootperms' class='x2-note errorMsg'>" .
			CHECKING_PERMISSIONS . "<br />" . ERR_NEED_WRITE_ACCESS;

	echo "<div class='x2-note txtleft'>" ;
   foreach ( $ctrl->permErrors as $path => $result ) {
   	$msg_Writable = ($result == "w") ? sprintf( IS_WRITABLE, $path ) : sprintf( IS_NOT_WRITABLE, $path );
   	echo xoDiag( ($result == "w") ? 1 : -1 , $msg_Writable ) . "<br />";
	}

	echo "</div></div>";
}
$content = ob_get_contents();
ob_end_clean();

include 'install_tpl.php';

?>